package com.data.modules.wrt.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.data.modules.wrt.entity.WrtAiLog;
import com.data.modules.wrt.mapper.WrtAiLogMapper;
import com.data.modules.wrt.service.IWrtAiLogService;
import com.data.modules.wrt.vo.AiData;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 慧锐通预警统计
 * @Author: data-boot
 * @Date:   2023-10-09
 * @Version: V1.0
 */
@Service
public class WrtAiLogServiceImpl extends ServiceImpl<WrtAiLogMapper, WrtAiLog> implements IWrtAiLogService {

    @Autowired
    private WrtAiLogMapper wrtAiLogMapper;
    @Override
    public void synAiInfo() {
        //删除数据
        wrtAiLogMapper.deleteAllData();
        //定时任务通过开门记录
        List<AiData> list = wrtAiLogMapper.searchData();
        //组装相关参数
        list.stream().forEach(x->{
            WrtAiLog log = new WrtAiLog();
            log.setRoomsn(x.getRoomSn());
            log.setStatus(x.getDays());
            wrtAiLogMapper.insert(log);
        });

    }
}
